// src/api/auth/index.ts
import request from '@/utils/request';
// 获取数据
export function rolesPage(page: any, size: any, keywords: any) {
  return request({
    url: `/api/v1/roles/page?pageNum=${page}&pageSize=${size}&keywords=${keywords}`,
    method: 'get',
  })
}
// 添加
// export function addData(data: any) {
//   return request({
//     url: '/api/v1/roles',
//     method: 'post',
//     params: data,
//   })
// }
export function addData(data: any) {
  return request.post('/api/v1/roles', data)
}
// 修改
export function editData(id: any, params: any) {
  return request.put(`/api/v1/roles/${id}`, params)
}
// 删除
export function delData(ids: any) {
  return request.delete(`/api/v1/roles/${ids}`)
}
// 角色下拉列表
export function selData() {
  return request.get(`/api/v1/roles/options`)
}

// 角色表单数据
export function ruleData(roleId: any) {
  return request.get(`/api/v1/roles/${roleId}/form`)
}
// 获取角色的菜单ID集合
export function ruleId(roleId: any) {
  return request.get(`/api/v1/roles/${roleId}/menuIds`)
}
// 分配菜单(包括按钮权限)给角色
export function ruleMenus(roleId: any, params: any) {
  return request.put(`/api/v1/roles/${roleId}/menus`, params)
}
// 树形数组
export function ruleTree() {
  return request.get(`/api/v1/menus/options`)
}